package com.corejava.training.collections.car.pre15;

import java.util.*;

public class SimpleListDemo {

	
	public static void main(String[] args) {

		SimpleList sl1 = new SimpleList("Jane", "Account", 10);
		SimpleList sl2 = new SimpleList("Jack", "Sales", 12);
		SimpleList sl3 = new SimpleList("Smith", "Support", 14);

		// add objects to List with java 1.4 style
		List l1 = new ArrayList();
		l1.add(sl1);
		l1.add(sl2);
		l1.add(sl3);
		

		// read from List and print out
		Iterator ite = l1.iterator();
		
		while(ite.hasNext()){
			SimpleList slist = (SimpleList)ite.next();
			
			System.out.println("Name: " + slist.getEmpname());
			System.out.println("Department: " + slist.getEmpdept());
			System.out.println("Id: " + slist.getEmpid()); 
			System.out.println("-----------------------------"); 
			
		}
		
	}

}
